﻿<?php
defined('BASEPATH') or exit('No direct script access allowed');

class ProjectSearch extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model("Academia_job_model");
		$this->load->model("Academia_job_kh_model");
		$this->load-> model("Subject_platform_model");	
		$this->load-> model("Subject_platform_kh_model");	
		$this->load->model("Academic_report_model");
		$this->load->model("Academic_report_kh_model");
		$this->load->model("Audit_model");
		$this->load->model("Awards_model");
		$this->load->model("Awards_kh_model");
		$this->load->model("Communication_model");
		$this->load->model("Communication_kh_model");
		$this->load->model("Horizontal_project_model");
		$this->load->model("Horizontal_project_kh_model");
		$this->load->model("Monograph_model");
		$this->load->model("Monograph_kh_model");
		$this->load->model("Paper_model");
		$this->load->model("Paper_kh_model");
		$this->load->model("Patent_data_model");
		$this->load->model("Patent_model");
		$this->load->model("Patent_kh_model");
		$this->load->model("Research_report_model");
		$this->load->model("Research_report_kh_model");
		$this->load->model("Science_conversion_model");
		$this->load->model("Science_conversion_kh_model");
		$this->load->model("Technical_standard_model");
		$this->load->model("Technical_standard_kh_model");
		$this->load->model("Vertical_project_model");
		$this->load->model("Vertical_project_kh_model");
        $this->load->library('ProjectService/check_service');
    }

    //根据唯一编码搜索
    public function getProjectData(){
        $param = $_POST;
		if(!isset($param['pageNo']) || $param['pageNo'] == "" || $param['pageNo'] == null){
			exit(retJson("请传入pageNo参数", false));
		}

		if(!isset($param['pageSize']) || $param['pageSize'] == ""|| $param['pageSize'] == null){
			exit(retJson("请传入pageSize参数", false));
		}
		if(isset($param['code']) && $param['code'] != ""){
			$code = $param['code'];
			$get_only_code_arr = $this->check_service->analysis_only_code_value($code);
			$data = $this->check_service->selectProject($get_only_code_arr['cgtype_code'],$param);
		}else{
			if(!isset($param['cgtype_code']) || $param['cgtype_code'] == "" || $param['cgtype_code'] == null ){
			    exit(retJson("请传入成果类型", false));
			}

			$data = $this->check_service->selectProject($param['cgtype_code'],$param);

		}
      
        
       exit(retJson("返回数据！", true,$data));

    }

 	//解码
	public function getCode(){
		$param = $_POST;
        if(!isset($param['code']) || $param['code'] == ""){
            exit(retJson("请传入参数", false));
        }
        $code = $param['code'];
		$get_only_code_arr = $this->check_service->analysis_only_code_value($code);
		exit(retJson("返回数据！", true,$get_only_code_arr));
	}

	//给老数据生成code
	public function setoldcode(){

		$data1 = $this->check_service->set_old_code('a');
		$data2 = $this->check_service->set_old_code('b');
		$data3 = $this->check_service->set_old_code('c');
		$data4 = $this->check_service->set_old_code('d');
		$data5 = $this->check_service->set_old_code('e');
		$data6 = $this->check_service->set_old_code('f');
		$data7 = $this->check_service->set_old_code('g');
		$data8 = $this->check_service->set_old_code('h');
		$data9 = $this->check_service->set_old_code('i');
		$data10 = $this->check_service->set_old_code('j');
		$data11 = $this->check_service->set_old_code('m');
		
		exit(retJson("执行完成", true));
	}


}
